package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.wemedia.dtos.WmChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.service.WmChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description TODO
 * @Author bo.li
 * @Date 2023/3/16 10:49
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/v1/channel")
public class WmChannelController {

    @Autowired
    private WmChannelService wmChannelService;

    @GetMapping("/channels")
    public ResponseResult listAll(){
       return wmChannelService.findAll();
    }


    @GetMapping("/delect")
    public ResponseResult delectChannel(@PathVariable Integer id){
        return wmChannelService.delectChannel(id);
    }

    @PostMapping("/sreach")
    public ResponseResult list(@RequestBody WmChannelDto wmChannelDto) {
       return wmChannelService.list(wmChannelDto);

    }
    @PostMapping("/insert")
    public ResponseResult save(@RequestBody WmChannel wmChannel){
        return wmChannelService.insert(wmChannel);
    }

    @PostMapping("/update")
    public ResponseResult update(@RequestBody WmChannel wmChannel){

         return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
    }



}